package tmp;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;




public class Login extends HttpServlet  {
	private static final long serialVersionUID = 1L;
       

	
	
    public Login() {
        super();
        
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//request.getRequestDispatcher("jsp/exist.jsp").include(request, response);
		
		String login = request.getParameter("login");
		String pass = request.getParameter("password");
		
		HttpSession session = request.getSession();
		session.setAttribute("naszaSesja", login);
			 HttpSession a = session;
			 a.getId();
			
		
		//session.getAttribute("naszaSesja");
		
		
		DB_Login db = new DB_Login();
		try {
			db.db(login, pass);
			
		} catch (ClassNotFoundException e) {
			
			e.printStackTrace();
		} catch (SQLException e) {
			
			e.printStackTrace();
		}
		
		
		
		
		
	}
	
	
	

}
